/*
 * Program.cpp
 *
 *  Created on: 17 mai 2011
 *      Author: seeme
 */
#include "Program.h"

void Program::pushAttrib(std::string attrib){
	m_uniforms.insert(std::pair<std::string, GLuint>(attrib, glGetUniformLocation(m_progId, attrib.c_str())));
}

GLuint Program::operator()(std::string attrib){
	std::map<std::string, GLuint>::iterator look = m_uniforms.find(attrib);
	if(look != m_uniforms.end()){
		return look->second;
	}
	return -1;
}

void Program::pushAttrib(const char* attrib){
	//Log::i("Program") << "Pushing " << attrib << ", id=" << glGetUniformLocation(m_progId, attrib);
	m_uniforms.insert(std::pair<std::string, GLuint>(attrib, glGetUniformLocation(m_progId, attrib)));
}

GLuint Program::operator()(const char* attrib){
	std::string name(attrib);
	std::map<std::string, GLuint>::iterator look = m_uniforms.find(name);
	if(look != m_uniforms.end()){
		return look->second;
	}
	return -1;
}

